/**
 * Created by root on 17-2-14.
 */
import {
  HEAD_SHOW_FAIL,
  HEAD_SHOW_SUCCESS,
  UPDATE_LOADING,
  FOOT_HIDE,
  FOOT_SHOW,
  LOGIN_TRUE,
  LOGIN_FALSE
} from './type'

const state = {
  headShow: true,
  isLoading: false,
  footShow: true,
  userLogin: false
}

const mutations = {

  /**
   * 头部
   */
  [HEAD_SHOW_SUCCESS] (state) {
    state.headShow = true
  },
  [HEAD_SHOW_FAIL] (state) {
    state.headShow = false
  },
  [FOOT_HIDE] (state) {
    state.footShow = false
  },
  [FOOT_SHOW] (state) {
    state.footShow = true
  },
  [LOGIN_TRUE] (state) {
    state.userLogin = true
  },
  [LOGIN_FALSE] (state) {
    state.userLogin = false
  },
  [UPDATE_LOADING] (state, payload) {
    state.isLoading = payload.isLoading
  }
}

const getters = {
  headShow (state) {
    return state.headShow
  },
  footShow (state) {
    return state.footShow
  },
  userLogin (state) {
    return state.userLogin
  }
}

export default {
  state,
  mutations,
  getters
}
